<!-- 历史审批 -->
<template>
    <div>
        <el-button :disabled="disabled" @click="handleQuery">
            修改记录
        </el-button>

        <el-dialog draggable v-model="dialogTableVisible" title="修改记录">
            <el-table :data="gridData">
                <el-table-column property="commissionBusiCode" label="受托业务" min-width="120px" show-overflow-tooltip>
                    <template v-slot="{row}">
                        <DictTag :dict-list="commission_busi" :dict-key="row.commissionBusiCode"/>
                    </template>
                </el-table-column>
                <el-table-column property="freeFlag" label="免费标识" min-width="120px" show-overflow-tooltip>
                    <template v-slot="{row}">
                        <DictTag :dict-list="free_flag" :dict-key="row.freeFlag"/>
                    </template>
                </el-table-column>
                <el-table-column property="purInventoryAdd" label="采购库存地点" min-width="120px"
                                 show-overflow-tooltip/>
                <el-table-column property="planDod" label="计划交货日期" min-width="120px" show-overflow-tooltip/>
                <el-table-column property="designatedSupplier" label="指定供应商" min-width="120px"
                                 show-overflow-tooltip/>
                <el-table-column property="approveNum" label="审核数量" min-width="120px" show-overflow-tooltip/>
                <el-table-column property="supplyMode" label="供货方式" min-width="120px" show-overflow-tooltip>
                    <template v-slot="{row}">
                        <DictTag :dict-list="supply_mode" :dict-key="row.supplyMode"/>
                    </template>
                </el-table-column>
                <el-table-column property="whseTurnoverRate" label="预估提货后总仓周转率" min-width="120px"
                                 show-overflow-tooltip/>
                <el-table-column property="coTurnoverRate" label="预估提货后全公司周转率" min-width="120px"
                                 show-overflow-tooltip/>
                <el-table-column property="specialDesc" label="特殊说明" min-width="120px" show-overflow-tooltip/>
                <el-table-column property="updateBy" label="修改人" min-width="120px" show-overflow-tooltip/>
                <el-table-column property="updateTime" label="修改日期" min-width="120px" show-overflow-tooltip/>
            </el-table>
        </el-dialog>
    </div>
</template>

<script setup>
import {getCurrentInstance, ref} from 'vue'
import {doGet, fillUser} from '@/config/http'

const {proxy} = getCurrentInstance();
const svc = ref('peas-module-plan-biz')

const props = defineProps({
    params: Object,
    disabled: {
        type: Boolean,
        default: false
    }
});
const {commission_busi, free_flag, supply_mode} = proxy.useDict(
    'commission_busi',
    'free_flag',
    'supply_mode'
);

const dialogTableVisible = ref(false)

const gridData = ref([])

function handleQuery() {
    if (!props.params) {
        proxy.$alert('请选择需要查询历史需求单信息的记录', "提示", {type: 'warning'})
        return false
    }
    doGet(svc.value, '/req-item-history-ex/query-list', props.params).then(res => {
        gridData.value = res
        fillUser(gridData.value, ["updateBy"], ["updateBy"])

        dialogTableVisible.value = true
    }).catch(e => {
        console.error(e)
    })
}
</script>
<style scoped>
.el-button--text {
    margin-right: 15px;
}

.el-select {
    width: 300px;
}

.el-input {
    width: 300px;
}

.dialog-footer button:first-child {
    margin-right: 10px;
}
</style>
